from manim import *
import manimpango

class TaroLogo_right(MovingCameraScene):
    def construct(self):
        self.camera.background_color = WHITE  # 设置相机的背景颜色为白色
        
        print(manimpango.list_fonts())
        text = Text(
            "得意黑",
            font='Smiley Sans Oblique',
        )
        self.add(text)

        MyTexTemplate = TexTemplate(
            tex_compiler="xelatex",
            output_format='.xdv',
        )
        MyTexTemplate.add_to_preamble(r"\usepackage{fontspec}\setmainfont{Smiley Sans Oblique}")

        tex = Tex(
            "得意黑",
            tex_template=MyTexTemplate,
            color = BLUE,
        ).next_to(text, DOWN)
        self.add(tex)
        
        tex_yunidangao = Tex(r"TARO", color = BLACK, font_size=100)
        # self.play(Write(tex_yunidangao), run_time=1)
        self.play(
            self.camera.frame.animate.shift(RIGHT*2.2222).set(width = 20),
        )
        
        logo_cir_big = Circle(fill_opacity=1, radius=5).set_opacity(0)
        logo_cir_big.set_color( ['#e4e7c7', '#ffa9f9', '#a08a9f'] )
        logo_cir_big.set_sheen_direction(DL)
        
        logo_cir_small = Circle(fill_opacity=1, radius=4.56789).set_opacity(0)
        logo_cir_small.set_color( ['#ffffff', '#fff9e3', '#ffdffe'] )
        logo_cir_small.set_sheen_direction(DR)
        logo_cir_small.shift(LEFT*0.343+DOWN*0.323)
        # logo_cir.fill_color = ['#ffffff', '#fff9e3', '#ffdffe']
        
        logo_text_taro = SVGMobject("./svgconverter/image_taro_nobg.svg", stroke_width=5 ).set_opacity(0).scale(1.4).shift(LEFT*2.2222+DOWN*0.8888)
        logo_text_cake = SVGMobject("./svgconverter/image_cake_nobg.svg", stroke_width=2 ).set_opacity(0).scale(0.42).shift(LEFT*2.2222+DOWN*3)
        logo_text_yuni = SVGMobject("./svgconverter/image_yuni_nobg.svg", stroke_width=2 ).set_opacity(0).scale(1.4).shift(RIGHT*1+DOWN*1)

        # self.play(FadeIn(logo_text_cake))

        self.play(
            AnimationGroup(
                logo_cir_big.animate.shift(RIGHT*2.2222).set_opacity(1),
                logo_cir_small.animate.shift(RIGHT*2.2222).set_opacity(1),
                logo_text_yuni.animate.shift(RIGHT*2.2222).set_opacity(1),
                logo_text_taro.animate.shift(RIGHT*2.2222).set_opacity(1),
                logo_text_cake.animate.shift(RIGHT*2.2222).set_opacity(1),
                
                lag_ratio=0.3
            )
        )
        

        # 保持显示
        self.wait(2)

